<?php
namespace ImiDemo\HttpDemo\MainServer\Model;

use Imi\Model\Model;
use Imi\Model\Annotation\Table;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Relation\JoinTo;
use Imi\Model\Annotation\Relation\JoinFrom;
use Imi\Model\Annotation\Relation\OneToOne;
use Imi\Model\Annotation\Relation\OneToMany;
use Imi\Model\Annotation\Relation\AutoDelete;
use Imi\Model\Annotation\Relation\AutoInsert;
use Imi\Model\Annotation\Relation\AutoUpdate;

/**
 * User
 * @Entity
 * @Table(name="tb_user", id={"id"})
 * @property int $id
 * @property string $username
 * @property \ImiDemo\HttpDemo\MainServer\Model\UserEx $ex
 * @property \Imi\Util\ArrayList $friends
 */
class UserWithFriend extends User
{
    /**
     * @OneToMany("UserFriend")
     * @JoinTo("user_id")
     * @AutoInsert(true)
     * @AutoUpdate(orphanRemoval=true)
     * @AutoDelete(true)
     *
     * @var \Imi\Util\ArrayList
     */
    protected $friends;

    /**
     * Get the value of friends
     *
     * @return  \ImiDemo\HttpDemo\MainServer\Model\UserFriend[]
     */ 
    public function getFriends()
    {
        return $this->friends;
    }

    /**
     * Set the value of friends
     *
     * @param  \ImiDemo\HttpDemo\MainServer\Model\UserFriend[]  $friends
     *
     * @return  self
     */ 
    public function setFriends($friends)
    {
        $this->friends = $friends;

        return $this;
    }

}